Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

[MXNET-400] support string type for kvstore key in cpp-package #10792

Merged
merged 6 commits into from
Apr 9, 2019

Conversation

nihui
Copy link
Contributor

@nihui nihui commented May 3, 2018

Description

implement string key variant for KVStore in cpp-package

Checklist

Essentials

Please feel free to remove inapplicable items for your PR.

  • The PR title starts with [MXNET-$JIRA_ID], where $JIRA_ID refers to the relevant JIRA issue created (except PRs with tiny changes)
  • Changes are complete (i.e. I finished coding on this PR)
  • All changes have test coverage:
  • Unit tests are added for small changes to verify correctness (e.g. adding a new operator)
  • Nightly tests are added for complicated/long-running ones (e.g. changing distributed kvstore)
  • Build tests will be added for build configuration changes (e.g. adding a new build option with NCCL)
  • Code is well-documented:
  • For user-facing API changes, API doc string has been updated.
  • For new C++ functions in header files, their functionalities and arguments are documented.
  • For new examples, README.md is added to explain the what the example does, the source of the dataset, expected performance on test set and reference to the original paper if applicable
  • Check the API doc at http://mxnet-ci-doc.s3-accelerate.dualstack.amazonaws.com/PR-$PR_ID/$BUILD_ID/index.html
  • To the my best knowledge, examples are either not affected by this change, or have been fixed to be compatible with this change

@nihui nihui changed the title [WIP] support string type for kvstore key in cpp-package [MXNET-400] support string type for kvstore key in cpp-package May 4, 2018
@nswamy
Copy link
Member

nswamy commented Aug 9, 2018

@mxnet-label-bot please add [kvstore, pr-awaiting-review]

@marcoabreu marcoabreu added KVStore pr-awaiting-review PR is waiting for code review labels Aug 9, 2018
@lupesko
Copy link
Contributor

lupesko commented Aug 21, 2018

@nihui can you please look into the failing CI tests? thanks for your contribution!

@lupesko
Copy link
Contributor

lupesko commented Sep 5, 2018

@nihui bounce...

@nihui
Copy link
Contributor Author

nihui commented Sep 6, 2018

Hi
I am traveling now.
I will study this issue later next week.

@nihui nihui requested a review from nswamy as a code owner September 11, 2018 04:57
@stu1130
Copy link
Contributor

stu1130 commented Sep 21, 2018

@nswamy would you mind to take a look at it! Thanks

@vandanavk
Copy link
Contributor

@leleamol for review

@vrakesh
Copy link
Contributor

vrakesh commented Oct 9, 2018

@leleamol Requesting a review on this PR.

@Roshrini
Copy link
Member

@rahul003 @cjolivier01 Can you please review this PR? Thanks

@ankkhedia
Copy link
Contributor

@leleamol @rahul003 @nswamy ping!
Could you please review this PR?

Copy link
Member

@rahul003 rahul003 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, except the fact that it doesn't have tests. Could you please add couple of cpp tests? You can look at these for examples : https://github.com/apache/incubator-mxnet/blob/master/tests/cpp/kvstore/gpu_topology_test.cc

@nihui
Copy link
Contributor Author

nihui commented Nov 15, 2018

new kvstore testcase added

@stu1130
Copy link
Contributor

stu1130 commented Nov 20, 2018

Thanks @nihui for adding the test. @rahul003 could you please take a look at it?


std::string key = "singlekeytest";

NDArray result(Shape(4), Context::cpu());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add similat test for gpu context? Or make this test configurable to run on cpu as well as gpu.

ret += (results[1].GetData()[j] == (grads[1].GetData()[j] + grads[2].GetData()[j])) ? 0 : 1;
}

return ret;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding the unit test. However, it would be helpful if you can add some logging. Especially, for the cases when the test fails.

@lupesko
Copy link
Contributor

lupesko commented Dec 11, 2018

@nihui thanks for your contribution! can you please look into the comments and failing builds?

@Roshrini
Copy link
Member

@nihui Can you please address comments and rebase this PR so that we can move forward with it?

@Roshrini
Copy link
Member

Roshrini commented Jan 2, 2019

@nihui Could you please rebase this PR?
@mxnet-label-bot Update [pr-awaiting-testing, KVStore]

@marcoabreu marcoabreu added pr-awaiting-testing PR is reviewed and waiting CI build and test and removed pr-awaiting-review PR is waiting for code review labels Jan 2, 2019
Copy link
Contributor

@stu1130 stu1130 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution @nihui
The rest part LGTM
Could you rebase the PR?

// initialize data
std::vector<NDArray> datas(2);
datas[0] = NDArray({0.f, 2.f, -3.12f, 4.f}, Shape(4), Context::cpu());
datas[1] = NDArray({0.8f, -2.f, 6.6f, 77.f}, Shape(4), Context::cpu());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit

Suggested change
datas[1] = NDArray({0.8f, -2.f, 6.6f, 77.f}, Shape(4), Context::cpu());
data[1] = NDArray({0.8f, -2.f, 6.6f, 77.f}, Shape(4), Context::cpu());

KVStore::SetType("local");

int ret1 = test_single_key();
int ret2 = test_multiple_key();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it be better if adding some info to know which test case is falling?

@sandeep-krishnamurthy
Copy link
Contributor

@nihui - Very useful contribution. Thanks. Last few things and we are good to go here:

  1. Please address test case comment by @leleamol
  2. Please make nit changes suggested by @stu1130
  3. Please rebase and resolve conflicts

@vandanavk
Copy link
Contributor

@mxnet-label-bot update [KVStore, pr-awaiting-response]

@marcoabreu marcoabreu added pr-awaiting-response PR is reviewed and waiting for contributor to respond and removed pr-awaiting-testing PR is reviewed and waiting CI build and test labels Feb 5, 2019
@ankkhedia
Copy link
Contributor

@nihui Thanks for your contribution! COuld you look into the comments added by @sandeep-krishnamurthy

@anirudhacharya
Copy link
Member

@nihui ping to update your PR with extra tests.

@lupesko
Copy link
Contributor

lupesko commented Mar 18, 2019

@nihui - since there was no feedback/follow up on feedback since May 2018, we should probably close the PR. You can always re-open if done in error.
@Roshrini can you please help by closing this?

@Roshrini
Copy link
Member

Hi @nihui, Thank you so much for working on this. This PR is open since long time with no action. I am closing it for now. Please do reopen if closed in error and we can help you to take it to completion.

@Roshrini Roshrini closed this Mar 19, 2019
@nihui
Copy link
Contributor Author

nihui commented Mar 29, 2019

hello, I'm unable to reopen a this closed PR. "Reopen" option is missing here.

@TaoLv
Copy link
Member

TaoLv commented Mar 29, 2019

Reopen for you @nihui

@nihui nihui changed the title [MXNET-400] support string type for kvstore key in cpp-package [WIP] [MXNET-400] support string type for kvstore key in cpp-package Mar 29, 2019
* support string type for kvstore key in cpp-package

* make lines short

* fix build

* add kvstore testcase

* no rand() use

* fix cpplint sanity check

* support string type for kvstore key in cpp-package

* make lines short

* fix build

* print error log
@nihui nihui changed the title [WIP] [MXNET-400] support string type for kvstore key in cpp-package [MXNET-400] support string type for kvstore key in cpp-package Apr 1, 2019
@nihui
Copy link
Contributor Author

nihui commented Apr 1, 2019

gpu unittest added, which is disabled automatically on cpu-only machine
log verbose error on fail

@piyushghai
Copy link
Contributor

@leleamol @rahul003 @nswamy ping!
Could you please review this PR?

Copy link
Member

@wkcn wkcn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution! LGTM.

cpp-package/example/test_kvstore.cpp Outdated Show resolved Hide resolved
cpp-package/include/mxnet-cpp/kvstore.h Show resolved Hide resolved
cpp-package/example/test_kvstore.cpp Outdated Show resolved Hide resolved
cpp-package/example/test_kvstore.cpp Show resolved Hide resolved
cpp-package/example/test_kvstore.cpp Show resolved Hide resolved
@wkcn wkcn added pr-awaiting-merge Review and CI is complete. Ready to Merge and removed pr-awaiting-response PR is reviewed and waiting for contributor to respond labels Apr 8, 2019
@wkcn wkcn merged commit 74e71e9 into apache:master Apr 9, 2019
@wkcn
Copy link
Member

wkcn commented Apr 9, 2019

Merged. Thanks for your contribution!

haohuanw pushed a commit to haohuanw/incubator-mxnet that referenced this pull request Jun 23, 2019
…e#10792)

* Kvstore strkey (apache#2)

* support string type for kvstore key in cpp-package

* make lines short

* fix build

* add kvstore testcase

* no rand() use

* fix cpplint sanity check

* support string type for kvstore key in cpp-package

* make lines short

* fix build

* print error log

* Update test_kvstore.cpp

* update

* add gpu unittest

* check gpu count

* fix sanity check
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
KVStore pr-awaiting-merge Review and CI is complete. Ready to Merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.